#include<stdio.h>
int main()
{
	int a,b,n,sum=0;
	scanf("%d",&n);
	for(;n!=0;n--){
		for(a=n,b=n;b!=0;){
			a=b%10;
			b=b/10;
			sum+=a;}
	}
	printf("%d\n",sum);
	return 0;
}

